package main;

import java.awt.Container;
import java.awt.Dimension;
import java.io.IOException;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;

import controller.FullScreenController;
import controller.KeyboardController;

import view.TreeView;

import classifier.ClassifierModel;


public class Runner extends JFrame{
	
	private static final long serialVersionUID = 1L;
	
	private ClassifierModel model;
	private TreeView treeView;
	private KeyboardController keyboardController;
	private FullScreenController fullscreenController;
	private JTabbedPane tabPane;
	private JScrollPane treePane;
	
	public Runner() throws IOException{
		super();
		
		//Initialize model
		this.model = new ClassifierModel();
		
		//Initialize controllers and add listeners
		this.keyboardController = new KeyboardController(this);
		this.fullscreenController = new FullScreenController(this);
		
		this.addKeyListener(keyboardController);
		this.addWindowStateListener(fullscreenController);
		
		//Initialize and add views
		this.treeView = new TreeView(model);
		this.treePane = new JScrollPane(treeView);
		
		//initialise tabPane and add views to tabpages
		tabPane = new JTabbedPane();
		tabPane.add("TreeView", treePane);
		tabPane.addKeyListener(keyboardController);
		
		//add tabpane to jFrame
		this.add(tabPane);
		
		
		//validate frame elements, and setvisible
		this.setPreferredSize(
				new Dimension(1024,768)
				);
		
		this.pack();
		this.setVisible(true);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

	}
	
	

}
